Skip to content

Commit

Permalink
chore, remove legacy scripts, remove src directory (#9365)
Browse files Browse the repository at this point in the history
Add back @teambit/legacy package with its newest version to teambit/bit policy. It's needed for backward compatibility for some envs that use it.
  • Loading branch information
davidfirst authored Dec 10, 2024
1 parent 1fe0bb1 commit c2d3faa
Show file tree
Hide file tree
Showing 22 changed files with 211 additions and 772 deletions.
32 changes: 1 addition & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,6 @@ jobs:
steps:
- attach_workspace:
at: ./
- run:
name: 'generate types'
command: 'cd bit && npm run build:types'
- run:
name: 'run TSC'
command: 'cd bit && npm run check-types'
Expand Down Expand Up @@ -474,20 +471,13 @@ jobs:
key: core-aspect-env-v0.0.63-v1
paths:
- /home/circleci/Library/Caches/Bit/capsules/caec9a107
- run: cd bit && npm run link-bit-legacy
# - run: cd bit && bbit compile

# the following 3 commands should help debugging a random error on Circle: "sh: 1: babel: not found"
# - run: cd bit && ls -l node_modules/@babel
# - run: cd bit && ls -l node_modules/@babel/cli/bin
# - run: cd bit && ls -l node_modules/.bin

- run:
name: 'Build bit source code'
command: 'cd bit && npm run build'
- run:
name: 'Build bit-legacy types'
command: 'cd bit && npm run build:types'
- persist_to_workspace:
root: .
paths:
Expand Down Expand Up @@ -566,7 +556,6 @@ jobs:
- run:
name: setting npmjs registry with publishing permission
command: echo "//registry.npmjs.org/:_authToken=${npmjsRegistryToken}" >> ~/.npmrc
# - run: cd bit && node scripts/bump-bit-legacy-ver.js
- run: bvm link
- run: cd bit && bit config set force_local_build true
# temporary, check if we can remove it
Expand All @@ -582,11 +571,9 @@ jobs:
- run: cd bit && git diff
# - run: cd bit && rm -rf node_modules/@teambit/legacy
# - run: cd bit && bbit checkout head
# - run: cd bit && npm run link-bit-legacy
# since we removed the node_modules we need to make sure we compile, install and link everything again
# - run: cd bit && bbit install --skip-import
# - run: cd bit && bbit compile
- run: cd bit && npm run link-bit-legacy
# temporary, check if we can remove it
- run: cd bit && bit cc

Expand Down Expand Up @@ -880,7 +867,7 @@ jobs:
- run: 'cd bit && mkdir junit'
- run: 'bit config set package-manager.cache /home/circleci/package-manager-cache'
# Make sure when we run bit from e2e tests we run it from the global not from here
- run: 'rm bit/node_modules/.bin/bit'
- run: 'rm -rf bit/node_modules/.bin/bit'
- run:
name: 'Run e2e tests'
command: 'cd bit && circleci tests glob "e2e/**/*.e2e*.ts" | circleci tests split --split-by=filesize | xargs -n 1 npm run mocha-circleci'
Expand Down Expand Up @@ -995,18 +982,6 @@ jobs:
paths:
- bit/node_modules

windows_build:
<<: *windows_defaults
steps:
- attach_workspace:
at: .
- run:
name: 'Build bit source code'
command: 'cd bit; npm run build'
- persist_to_workspace:
root: .
paths:
- bit/dist

windows_bvm_install:
<<: *windows_defaults
Expand Down Expand Up @@ -1083,8 +1058,6 @@ jobs:
- run: 'ls bit\bit'
- run: 'cd bit\bit; bit install'
- run: 'cd bit\bit; bit compile'
- run: 'cd bit\bit; npm run build'
- run: 'cd bit\bit; npm run build:types:windows'
- persist_to_workspace:
root: .
paths:
Expand Down Expand Up @@ -1263,9 +1236,6 @@ workflows:
# requires:
# - windows_checkout_code
# - windows_set_npm_registries
# - windows_build:
# requires:
# - windows_install_npm_deps
# - windows_e2e_test:
# requires:
# - windows_build
Expand Down
20 changes: 1 addition & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ the setup process is more involving than expected because we write bit using bit
the script does the following:

1. runs `bit install` to install all dependencies.
2. runs `npm run link-bit-legacy` to create a symlink for the bit-legacy package.
3. runs `bit compile` to compile all components in the workspace (Harmony code).
4. compiles bit-legacy code (by `npm run build`).
5. generates the d.ts files for the bit-legacy code (by `npm run build:types`).
2. runs `bit compile` to compile all components in the workspace.

install command globally and link (in order to use the "bit-dev" command globally and always use the
latest development build)
Expand Down Expand Up @@ -50,15 +47,6 @@ bit will install these commands in `/usr/local/bin/` directory, so in order to r

### Build

Depends on where your changes were made, you'll need to build the legacy code or Harmony code.
If the changes were done in `src/` directory, then it's the legacy. Otherwise, it's probably in `scopes/` directory and it's the new code.

- build bit-legacy code

```bash
npm run build
```

- build bit Harmony code

```bash
Expand All @@ -69,12 +57,6 @@ If the changes were done in `src/` directory, then it's the legacy. Otherwise, i

It's easier to leave the watch process running instead of re-build for every change.

- watch bit-legacy code

```bash
npm run watch
```

- watch bit Harmony code

```bash
Expand Down
48 changes: 14 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,16 @@
"ts-coverage": "type-coverage",
"check-types": "tsc",
"ts-watch": "tsc -w",
"lint:only": "eslint \"{src,e2e,scopes,components}/**/*.{ts,tsx}\"",
"lint": "tsc && eslint \"{src,e2e,scopes,components}/**/*.{ts,tsx}\"",
"lint:table": "eslint \"{src,e2e,scopes,components}/**/*.{ts,tsx}\" --format table",
"lint:html": "eslint \"{src,e2e,scopes,components}/**/*.{ts,tsx}\" --format html -o eslint-report.html",
"lint-circle": "eslint \"{src,e2e,scopes,components}/**/*.{ts,tsx}\" --format junit -o junit/eslint-results.xml",
"lint:fix": "eslint \"{src,e2e,scopes,components}/**/*.{ts,tsx}\" --fix",
"lint:only": "eslint \"{e2e,scopes,components}/**/*.{ts,tsx}\"",
"lint": "tsc && eslint \"{e2e,scopes,components}/**/*.{ts,tsx}\"",
"lint:table": "eslint \"{e2e,scopes,components}/**/*.{ts,tsx}\" --format table",
"lint:html": "eslint \"{e2e,scopes,components}/**/*.{ts,tsx}\" --format html -o eslint-report.html",
"lint-circle": "eslint \"{e2e,scopes,components}/**/*.{ts,tsx}\" --format junit -o junit/eslint-results.xml",
"lint:fix": "eslint \"{e2e,scopes,components}/**/*.{ts,tsx}\" --fix",
"lint-full": "./scripts/validate-import-named-aspects.sh && ./scripts/validate-no-ramda.sh && node scripts/validate-pkg-exist-in-pkg-json.js && npm run lint",
"format": "prettier \"{src,e2e,scopes,components}/**/*.{ts,js,jsx,css,scss,tsx,md,mdx}\" --write",
"prettier:check": "prettier --list-different \"{src,e2e,scopes,components}/**/*.{ts,js,jsx,css,scss,tsx,md,mdx}\"",
"test": "mocha --require ./babel-register './src/**/*.spec.ts'",
"format": "prettier \"{e2e,scopes,components}/**/*.{ts,js,jsx,css,scss,tsx,md,mdx}\" --write",
"prettier:check": "prettier --list-different \"{e2e,scopes,components}/**/*.{ts,js,jsx,css,scss,tsx,md,mdx}\"",
"test:extensions": "mocha --require ./babel-register './scopes/**/*.spec.ts'",
"test-circle": "mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors './src/**/*.spec.ts'",
"mocha-circleci": "cross-env NODE_OPTIONS='--no-warnings --max-old-space-size=5000' registry-mock prepare && mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors",
"e2e-test": "registry-mock prepare && cross-env NODE_OPTIONS=--no-warnings mocha --require ./babel-register './e2e/**/*.e2e*.ts'",
"e2e-test:debug": "npm run e2e-test --debug --keep-envs",
Expand All @@ -67,17 +65,11 @@
"performance-test:debug": "npm run performance-test --debug --keep-envs",
"performance-test-circle": "mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors ./e2e/performance/*.performance*.ts",
"bit-hub-test-circle": "mocha --require ./babel-register --reporter mocha-multi-reporters --reporter-options configFile=mocha-multi-reporters-config.json --colors ./e2e/bit-hub/*.ts",
"clean": "rm -rf dist && rm -rf types",
"build": "npm run build:src",
"build:types": "./scripts/build-types.bash",
"build:types:windows": ".\\scripts\\build-types.bat",
"link-bit-legacy": "node ./scripts/link-bit-legacy.js",
"build-legacy": "rm -rf dist && npm run build && npm run build:types",
"setup": "bit install && bit compile && npm run build && npm run build:types && npm run link-bit-legacy",
"full-setup": "rm -rf node_modules/.bin/bit && rm -rf node_modules/@teambit/legacy && bit install && npm run link-bit-legacy && husky install && bit compile && npm run build-legacy",
"full-setup:bbit": "rm -rf node_modules/.bin/bbit && rm -rf node_modules/@teambit/legacy && bbit install && npm run link-bit-legacy && husky install && bbit compile && npm run build-legacy",
"full-setup:windows": "bit install && npm run link-bit-legacy && husky install && bit compile && npm run build && npm run build:types:windows",
"full-setup:windows:bbit": "rm -rf node_modules/.bin && rm -rf node_modules/@teambit/legacy && bbit install && npm run link-bit-legacy && npx husky install && npm run build && npm run build:types:windows && echo 'please run `bbit compile`'",
"setup": "bit install && bit compile",
"full-setup": "rm -rf node_modules/.bin/bit && bit install && husky install && bit compile",
"full-setup:bbit": "rm -rf node_modules/.bin/bbit && bbit install && husky install && bbit compile",
"full-setup:windows": "bit install && husky install && bit compile",
"full-setup:windows:bbit": "rm -rf node_modules/.bin && bbit install && npx husky install && echo 'please run `bbit compile`'",
"husky:install": "husky install",
"build-centos-image": "docker build ./scripts/linux/centos -t centos-rpm",
"build-debian-image": "docker build ./scripts/linux/debian -t debian-deb",
Expand All @@ -87,9 +79,6 @@
"pkg:mac": "pkg bin/bit.js --targets node10-macos-x64 --out-path releases/mac --options --no-warnings --config package.json",
"pkg:windows": "pkg bin/bit.js --targets node10-win-x64 --out-path releases/windows --options --no-warnings --config package.json",
"pkg:all": "pkg bin/bit.js --targets node10-macos-x64,node10-win-x64,node10-linux-x64 --out-path releases/ --options --no-warnings --config package.json",
"watch": "babel --watch src -d dist --verbose --source-maps --extensions \".ts,.tsx,.js\" --copy-files",
"build-debug": "babel src -d dist --source-maps --extensions \".ts\"",
"prepublishOnly": "npm run clean && npm run build && npm run build:types",
"pre-release": "gh-release -a releases/bit-legacy-linux,releases/bit-legacy-win.exe,releases/bit-legacy-macos --prerelease",
"release": "gh-release -a releases/bit-legacy-linux,releases/bit-legacy-win.exe,releases/bit-legacy-macos",
"release:circle": "gh-release -a releases/bit-legacy-linux,releases/bit-legacy-win.exe,releases/bit-legacy-macos -y",
Expand All @@ -98,23 +87,14 @@
"release:inc-pack": "npm run pkg:all && npm run release",
"brew-bump:dry-run": "BIT_VERSION=$(cat ./package.json | jq .version -r) && brew bump-formula-pr bit --url='https://registry.npmjs.org/bit-bin/-/bit-bin-${BIT_VERSION}.tgz' --message='version bump' --dry-run",
"brew-bump": "BIT_VERSION=$(cat ./package.json | jq .version -r) && brew bump-formula-pr bit --url='https://registry.npmjs.org/bit-bin/-/bit-bin-${BIT_VERSION}.tgz' --message='version bump'",
"types-wip": "tsc -p tsconfig.types-clean.json --outfile dist/index.d.ts",
"assert:master": "node ./scripts/assert-master.js",
"nightly": "npm run assert:master && git tag -d manual-nightly && git push --delete origin manual-nightly && git tag manual-nightly && git push origin manual-nightly",
"build:src": "babel src -d dist --verbose --extensions \".ts,.tsx,.js\" --copy-files",
"generate-cli-reference": "bit cli generate > scopes/harmony/cli-reference/cli-reference.mdx && prettier scopes/harmony/cli-reference/cli-reference.mdx --write",
"generate-cli-reference-json": "bit cli generate --json > scopes/harmony/cli-reference/cli-reference.json",
"generate-cli-reference-docs": "bit cli generate --docs > scopes/harmony/cli-reference/cli-reference.docs.mdx",
"lint-staged": "lint-staged"
},
"dependencies": {
"@teambit/legacy.scope-api": "~0.0.1",
"@teambit/component.sources": "~0.0.1",
"@teambit/legacy.consumer-component": "~0.0.1",
"@teambit/toolbox.crypto.sha1": "~0.0.1",
"@teambit/toolbox.time.timer": "~0.0.1",
"@teambit/legacy.utils": "~0.0.2"
},
"dependencies": {},
"devDependencies": {},
"pnpm": {
"neverBuiltDependencies": [
Expand Down
Loading

0 comments on commit c2d3faa

Please sign in to comment.