群组信息 私有

administrators

 

成员列表

  • 丧亲手册 发布在 笔记
  • Probably the best place to learn GraphQL 发布在 笔记
  • Useful Links 发布在 笔记
  • React Ref 发布在 笔记
  • RE: cannot load module - package.json and build folder needed

    @梵总 ./components/Common/CKEditor.js
    Module not found: Can't resolve '../../lib/ckeditor5-build-dna' in '/Users/dcai/Projects/next-feathers/next/components/Common'
    could be folder naming issue. 🙂

    发布在 笔记
  • ckeditor code block

    Weird!
    The code block version is 19.0.0 or 20.0.0?
    npm install --save @ckeditor/ckeditor5-code-block
    installed 20.0.0 which is not compatible to archived https://github.com/ckeditor/ckeditor5-build-classic (up to 19.0.0)
    Which causes ckeditor-duplicated-modules

    发布在 笔记
  • cannot load module - package.json and build folder needed

    Module not found: Can't resolve '../../lib/ckeditor5-build-dna' in '/Users/dcai/Projects/next-feathers/next/components/Common'

    Because missing package.json

    发布在 笔记
  • featherjs

    Use PATH instead of PUT, because PUT is idempotent.
    To use PUT, you have to put in all fields exception timestamp, but timestamp will never been updated.
    Use PATH to update partial data, and updatedAt will be automatically updated.

    发布在 笔记
  • Upload to S3 from Client Example
    import React from "react";
    import { withApollo } from "react-apollo";
    // import S3FileUpload from "react-s3";
    import S3 from "aws-s3";
    // import { Link } from "react-router-dom";
    
    // material-ui icons
    // import Assignment from "@material-ui/icons/Assignment";
    import CloudUploadIcon from "@material-ui/icons/CloudUpload";
    // core components
    
    import Button from "components/CustomButtons/Button.jsx";
    
    // @material-ui/core components
    import withStyles from "@material-ui/core/styles/withStyles";
    
    // core components
    import FormControl from "@material-ui/core/FormControl";
    import regularFormsStyle from "assets/jss/material-dashboard-pro-react/views/regularFormsStyle";
    
    import { GET_SECRET } from "../../graphql/User";
    import { CHECK_FILE } from "../../graphql/FileManager";
    import { RUN } from "../../graphql/Command";
    
    import config from "../../config";
    
    class Upload extends React.Component {
      state = {
        awsS3Config: {}
      };
      handleChangeFile = async event => {
        console.log(this.state.awsS3Config);
        const file = event.target.files[0];
        console.log(file);
        const fileName = file.name.trim().replace(/[^a-zA-Z0-9.]+/g, "-");
        //8233-2.jpg
        const newFileName = fileName
          .split(".")
          .slice(0, -1)
          .join(".");
        //8233-2;
    
        const newFile = new File([file], fileName, { type: file.type });
        const S3Client = new S3({
          ...this.state.awsS3Config,
          s3Url: config.s3.BASE_URL
        });
        S3Client.uploadFile(newFile, newFileName)
          .then(async res => {
            // console.log(res);
            let fileUrl = res.location;
            if (config.s3.COULD_URL) {
              fileUrl = fileUrl.replace(config.s3.BASE_URL, config.s3.COULD_URL);
            }
            const filePath = res.key;
    
            if (process.env.REACT_APP_N_ENV === "stage") {
              const { data } = await this.props.client.query({
                query: CHECK_FILE,
                variables: { fileUrl: fileUrl }
              });
              // console.log(data);
              const fileExist = data.checkFile;
              if (fileExist) {
                await this.props.client.query({
                  query: RUN,
                  variables: { command: "invalidate", filePath: filePath }
                });
              }
            }
            this.props.handleFileUploaded({
              url: fileUrl,
              size: file.size,
              fileType: file.type
            });
          })
          .catch(err => console.log(err));
        //Make a request to server and send formData
      };
    
      async componentDidMount() {
        const { data } = await this.props.client.query({
          query: GET_SECRET,
          fetchPolicy: "network-only",
          variables: { secretId: config.awsS3 }
        });
        this.setState({
          awsS3Config: JSON.parse(data.getSecret)
        });
      }
    
      render() {
        const { classes } = this.props;
        return (
          <FormControl>
            <input
              className={classes.input}
              id="contained-button-file"
              multiple
              type="file"
              onChange={this.handleChangeFile}
              style={{ display: "none" }}
            />
            <label htmlFor="contained-button-file">
              <Button variant="contained" component="span">
                Upload <CloudUploadIcon className={classes.rightIcon} />
              </Button>
            </label>
          </FormControl>
        );
      }
    }
    
    export default withApollo(withStyles(regularFormsStyle)(Upload));
    
    
    发布在 笔记
  • Fix ESLINT lib

    dcai@ICF2009542 next-feathers % npm list -g --depth 0
    /Users/dcai/.nvm/versions/node/v10.19.0/lib
    ├── @feathersjs/cli@4.3.0
    ├── create-next-app@9.3.5
    ├── csvtojson@2.0.10
    ├── UNMET PEER DEPENDENCY eslint@7.0.0
    ├── eslint-plugin-react@7.19.0
    ├── knex@0.20.10
    ├── mongoose@5.9.6
    ├── npm@6.13.4
    ├── npm-check-updates@4.0.4
    └── serverless@1.67.3

    npm ERR! peer dep missing: eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0, required by eslint-plugin-react@7.19.0
    dcai@ICF2009542 next-feathers % npm install -g eslint
    /Users/dcai/.nvm/versions/node/v10.19.0/bin/eslint -> /Users/dcai/.nvm/versions/node/v10.19.0/lib/node_modules/eslint/bin/eslint.js

    • eslint@7.3.1
      added 2 packages from 4 contributors, removed 31 packages, updated 17 packages and moved 2 packages in 4.464s
      dcai@ICF2009542 next-feathers % npm list -g --depth 0
      /Users/dcai/.nvm/versions/node/v10.19.0/lib
      ├── @feathersjs/cli@4.3.0
      ├── create-next-app@9.3.5
      ├── csvtojson@2.0.10
      ├── UNMET PEER DEPENDENCY eslint@7.3.1
      ├── eslint-plugin-react@7.19.0
      ├── knex@0.20.10
      ├── mongoose@5.9.6
      ├── npm@6.13.4
      ├── npm-check-updates@4.0.4
      └── serverless@1.67.3

    npm ERR! peer dep missing: eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0, required by eslint-plugin-react@7.19.0
    dcai@ICF2009542 next-feathers % npm install -g eslint-plugin-react
    npm WARN eslint-plugin-react@7.20.3 requires a peer of eslint@^3 || ^4 || ^5 || ^6 || ^7 but none is installed. You must install peer dependencies yourself.

    • eslint-plugin-react@7.20.3
      added 1 package from 1 contributor, removed 7 packages and updated 7 packages in 1.942s
      dcai@ICF2009542 next-feathers % npm list -g --depth 0
      /Users/dcai/.nvm/versions/node/v10.19.0/lib
      ├── @feathersjs/cli@4.3.0
      ├── create-next-app@9.3.5
      ├── csvtojson@2.0.10
      ├── eslint@7.3.1
      ├── eslint-plugin-react@7.20.3
      ├── knex@0.20.10
      ├── mongoose@5.9.6
      ├── npm@6.13.4
      ├── npm-check-updates@4.0.4
      └── serverless@1.67.3
    发布在 笔记