Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: offload package.json scripts to ts-node scripts #30

Open
mesqueeb opened this issue Oct 16, 2020 · 0 comments
Open

build: offload package.json scripts to ts-node scripts #30

mesqueeb opened this issue Oct 16, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@mesqueeb
Copy link
Member

mesqueeb commented Oct 16, 2020

I don't mind the dep: scripts, but the others are currently getting out of hand...

I just need these scripts:

  • dev
  • dev:docs
  • publish

And all other things that happen should happen in a ts-node script inside scripts/, using the dependency fs-extra as much as possible.

Also:
Anything that happens in the prepare script should be automated with a watcher somehow:

  • whenever anything in /packages/form changes, run something similar to the currently set up prepare:form
  • whenever anything in /packages/table changes, run something similar to the currently set up prepare:table
  • whenever anything in /packages/utils changes, execute npm run build in that folder

The scripts in package.json shown below should therefore be reduced to just the 3 I mention above.

"dev": "npm run prepare && npm run start:dev && cd packages/dev && npm run dev",
    "dev:docs": "npm run prepare && npm run start:dev && cd packages/docs && npm run dev",
    "dev:vuepress": "npm run prepare && npm run start:dev && cd packages/docs-vuepress && npm run dev",
    "test": "lerna run test",
    "build": "lerna run build",
    "build:utils": "cd packages/utils && npm run build",
    "build:form": "cd packages/form && npm run build",
    "build:for-publish": "npm run prepare && npm run start:build && lerna run build && npm run build:vue-int && git add -A && git commit -m \"chore: build\" && git push",
    "build:favicon": "copyfiles media/* packages/docs/public && cd packages/docs && npm run build:favicon",
    "build:vue-int": "lerna run vue-int && ts-node scripts/vueInt.ts",
    "build-and-publish": "npm run build:for-publish && npm run publish",
    "publish": "lerna publish && npm run publish:post",
    "publish:post": "npm run start:dev && git add -A && git commit -m \"chore: post-build\" && git push",
    "deploy:docs": "npm run build:for-publish && firebase deploy --only hosting && git add -A && git commit -m \"chore: deploy\" && git push",
    "prepare": "npm run prepare:form && npm run prepare:table",
    "prepare:form": "npm run copy:form-to-docs && npm run copy:form-to-vuepress && npm run copy:form-to-dev",
    "prepare:table": "npm run copy:table-to-docs && npm run copy:table-to-vuepress && npm run copy:table-to-dev",
    "copy:form-to-docs": "rimraf packages/docs/src/components/atoms/form && copyfiles --up 3 'packages/form/src/**/*' packages/docs/src/components/atoms/form",
    "copy:form-to-vuepress": "rimraf packages/docs-vuepress/src/.vuepress/components/atoms/form && copyfiles --up 3 'packages/form/src/**/*' packages/docs-vuepress/src/.vuepress/components/atoms/form",
    "copy:form-to-dev": "rimraf packages/dev/src/components/atoms/form && copyfiles --up 3 'packages/form/src/**/*' packages/dev/src/components/atoms/form",
    "copy:table-to-docs": "rimraf packages/docs/src/components/atoms/table && copyfiles --up 3 'packages/table/src/**/*' packages/docs/src/components/atoms/table",
    "copy:table-to-vuepress": "rimraf packages/docs-vuepress/src/.vuepress/components/atoms/table && copyfiles --up 3 'packages/table/src/**/*' packages/docs-vuepress/src/.vuepress/components/atoms/table",
    "copy:table-to-dev": "rimraf packages/dev/src/components/atoms/table && copyfiles --up 3 'packages/table/src/**/*' packages/dev/src/components/atoms/table",
    "replace:dist-src": "replace-in-files --string='\"module\": \"dist/index.js\"' --replacement='\"module\": \"src/index.js\"' 'packages/*/package.json'",
    "replace:src-dist": "replace-in-files --string='\"module\": \"src/index.js\"' --replacement='\"module\": \"dist/index.js\"' 'packages/*/package.json'",
    "start:dev": "npm run replace:dist-src",
    "start:build": "npm run replace:src-dist",
@mesqueeb mesqueeb added the enhancement New feature or request label Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants