forked from vercel/commerce
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace tsc with SWC for package compilation and file watching (verce…
…l#675) * Updated turbo version * Added taskr to packages/local * Move json files * Include missing extension * Fixed prettierignore * Updated swc plugin * Moved swc plugin to its own package * Added note * Removed unused package * Added watch for file changes * Added taskr deps to every package * Added taskfile to every package * Updated scripts in every package * Added 2 utiity scripts * Fix turbo dev script * Update swc plugin to include jsx import * Updated build script in main package.json
- Loading branch information
Showing
29 changed files
with
1,637 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# Every package defines its prettier config | ||
node_modules | ||
packages | ||
site | ||
dist | ||
.next | ||
public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,56 +7,20 @@ | |
"packages/*" | ||
], | ||
"scripts": { | ||
"build": "turbo run build --scope=next-commerce --include-dependencies --no-deps", | ||
"dev": "turbo run dev", | ||
"start": "turbo run start", | ||
"prettier-fix": "prettier --write ." | ||
}, | ||
"turbo": { | ||
"baseBranch": "origin/main", | ||
"pipeline": { | ||
"build": { | ||
"dependsOn": [ | ||
"^build" | ||
], | ||
"outputs": [ | ||
"dist/**" | ||
] | ||
}, | ||
"next-commerce#build": { | ||
"dependsOn": [ | ||
"^build", | ||
"$COMMERCE_PROVIDER" | ||
], | ||
"outputs": [ | ||
".next/**" | ||
] | ||
}, | ||
"test": { | ||
"dependsOn": [ | ||
"^build" | ||
], | ||
"outputs": [] | ||
}, | ||
"lint": { | ||
"outputs": [] | ||
}, | ||
"prettier-fix": { | ||
"outputs": [] | ||
}, | ||
"dev": { | ||
"cache": false | ||
}, | ||
"start": { | ||
"cache": false | ||
} | ||
} | ||
}, | ||
"devDependencies": { | ||
"husky": "^7.0.4", | ||
"prettier": "^2.5.1", | ||
"turbo": "^1.0.28" | ||
"turbo": "^1.1.2" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "turbo run lint" | ||
} | ||
} | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export async function build(task, opts) { | ||
await task | ||
.source('src/**/*.+(ts|tsx|js)') | ||
.swc({ dev: opts.dev, outDir: 'dist', baseUrl: 'src' }) | ||
.target('dist') | ||
.source('src/**/*.+(cjs|json)') | ||
.target('dist') | ||
task.$.log('Compiled src files') | ||
} | ||
|
||
export async function release(task) { | ||
await task.clear('dist').start('build') | ||
} | ||
|
||
export default async function dev(task) { | ||
const opts = { dev: true } | ||
await task.clear('dist') | ||
await task.start('build', opts) | ||
await task.watch('src/**/*.+(ts|tsx|js|cjs|json)', 'build', opts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export async function build(task, opts) { | ||
await task | ||
.source('src/**/*.+(ts|tsx|js)') | ||
.swc({ dev: opts.dev, outDir: 'dist', baseUrl: 'src' }) | ||
.target('dist') | ||
.source('src/**/*.+(cjs|json)') | ||
.target('dist') | ||
task.$.log('Compiled src files') | ||
} | ||
|
||
export async function release(task) { | ||
await task.clear('dist').start('build') | ||
} | ||
|
||
export default async function dev(task) { | ||
const opts = { dev: true } | ||
await task.clear('dist') | ||
await task.start('build', opts) | ||
await task.watch('src/**/*.+(ts|tsx|js|cjs|json)', 'build', opts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export async function build(task, opts) { | ||
await task | ||
.source('src/**/*.+(ts|tsx|js)') | ||
.swc({ dev: opts.dev, outDir: 'dist', baseUrl: 'src' }) | ||
.target('dist') | ||
.source('src/**/*.+(cjs|json)') | ||
.target('dist') | ||
task.$.log('Compiled src files') | ||
} | ||
|
||
export async function release(task) { | ||
await task.clear('dist').start('build') | ||
} | ||
|
||
export default async function dev(task) { | ||
const opts = { dev: true } | ||
await task.clear('dist') | ||
await task.start('build', opts) | ||
await task.watch('src/**/*.+(ts|tsx|js|cjs|json)', 'build', opts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export async function build(task, opts) { | ||
await task | ||
.source('src/**/*.+(ts|tsx|js)') | ||
.swc({ dev: opts.dev, outDir: 'dist', baseUrl: 'src' }) | ||
.target('dist') | ||
.source('src/**/*.+(cjs|json)') | ||
.target('dist') | ||
task.$.log('Compiled src files') | ||
} | ||
|
||
export async function release(task) { | ||
await task.clear('dist').start('build') | ||
} | ||
|
||
export default async function dev(task) { | ||
const opts = { dev: true } | ||
await task.clear('dist') | ||
await task.start('build', opts) | ||
await task.watch('src/**/*.+(ts|tsx|js|cjs|json)', 'build', opts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export async function build(task, opts) { | ||
await task | ||
.source('src/**/*.+(ts|tsx|js)') | ||
.swc({ dev: opts.dev, outDir: 'dist', baseUrl: 'src' }) | ||
.target('dist') | ||
.source('src/**/*.+(cjs|json)') | ||
.target('dist') | ||
task.$.log('Compiled src files') | ||
} | ||
|
||
export async function release(task) { | ||
await task.clear('dist').start('build') | ||
} | ||
|
||
export default async function dev(task) { | ||
const opts = { dev: true } | ||
await task.clear('dist') | ||
await task.start('build', opts) | ||
await task.watch('src/**/*.+(ts|tsx|js|cjs|json)', 'build', opts) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export async function build(task, opts) { | ||
await task | ||
.source('src/**/*.+(ts|tsx|js)') | ||
.swc({ dev: opts.dev, outDir: 'dist', baseUrl: 'src' }) | ||
.target('dist') | ||
.source('src/**/*.+(cjs|json)') | ||
.target('dist') | ||
task.$.log('Compiled src files') | ||
} | ||
|
||
export async function release(task) { | ||
await task.clear('dist').start('build') | ||
} | ||
|
||
export default async function dev(task) { | ||
const opts = { dev: true } | ||
await task.clear('dist') | ||
await task.start('build', opts) | ||
await task.watch('src/**/*.+(ts|tsx|js|cjs|json)', 'build', opts) | ||
} |
Oops, something went wrong.