Skip to content

Conversation

cvanem
Copy link

@cvanem cvanem commented May 19, 2019

Summary

RFC #116
Documentation: yarnpkg/website#951

Allow scripts to be imported from a file as an alternative to the standard object hash in the packages.json scripts field. Also define the basic structure of the imported file.

Test plan

The code was tested with this example input file:

module.exports = {
  delimiter: '.',
  scripts: {
    argos: 'argos upload test/regressions/screenshots/chrome --token $ARGOS_TOKEN',
    docs: {
      api: {
        default: {
          script: 'yarn docs.api.clean && yarn docs.api.mui && yarn docs.api.lab',
          description: 'Generates the api documentation',
        },
        clean: {
          script: 'rimraf ./pages/api',
          description: 'Removes all previously generated documenation',
          watch: {
            script: 'yarn docs.api.clean --watch',
          },
        },
      },
      build: {
        default: {
          script: 'yarn docs.build.clean && yarn docs.build.compile',
          description: 'Builds the documents.',
        },
        clean: {
          default: 'rimraf .next',
          watch: 'rimraf .next --watch',
        },
        compile: 'cross-env NODE_ENV=production BABEL_ENV=docs-production next build',
      },
      typescript: {
        default: 'node docs/scripts/formattedTSDemos --watch',
        check: 'tslint -p docs/tsconfig.json',
        formatted: 'node docs/scripts/formattedTSDemos',
      },
    },
    typescript: 'lerna run typescript && yarn docs.typescript.check',
  },
};

Which generates these scripts when executing yarn run:
image

@buildsize
Copy link

buildsize bot commented May 19, 2019

File name Previous Size New Size Change
yarn-[version].noarch.rpm 1.11 MB 1.11 MB 812 bytes (0%)
yarn-[version].js 4.48 MB 4.48 MB 3.24 KB (0%)
yarn-legacy-[version].js 4.67 MB 4.67 MB 3.69 KB (0%)
yarn-v[version].tar.gz 1.12 MB 1.12 MB 656 bytes (0%)
yarn_[version]all.deb 816.96 KB 817.3 KB 358 bytes (0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant