-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* set up typescript (#1) * set up package (#2) * set up package * Change exit code to 1 * fix error * fix error * add build all * fix error * add package-init script * change run script * 변수 명 수정 * change script name * fix error * Add npm i @types/node --save-dev * Feature/set up gulp (#8) * feature/refactoring (#9) * Feature/set up husky (#10) * Feature/set up nvmrc (#14) * Feature/set_up_lint (#11) * Feature/set_up_rust (#13) * Feature/set up jest (#15)
- Loading branch information
1 parent
855aae4
commit 1750992
Showing
27 changed files
with
870 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
script | ||
node_modules | ||
dist | ||
gulpfile.js |
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,28 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2020": true, | ||
"jest": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended", | ||
"prettier/@typescript-eslint", | ||
"airbnb-base" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 12, | ||
"sourceType": "module", | ||
"project": [ | ||
"tsconfig.json" | ||
] | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"no-console": "off" | ||
} | ||
} |
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,112 @@ | ||
# Logs | ||
old/logs | ||
*.log | ||
*.log.* | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
*.lcov | ||
|
||
# nyc tests coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# TypeScript cache | ||
*.tsbuildinfo | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Microbundle cache | ||
.rpt2_cache/ | ||
.rts2_cache_cjs/ | ||
.rts2_cache_es/ | ||
.rts2_cache_umd/ | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# Next.js build output | ||
.next | ||
|
||
# Nuxt.js build / generate output | ||
.nuxt | ||
dist | ||
|
||
# Gatsby files | ||
.cache/ | ||
# Comment in the public line in if your project uses Gatsby and *not* Next.js | ||
# https://nextjs.org/blog/next-9-1#public-directory-support | ||
# public | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
# TernJS port file | ||
.tern-port | ||
|
||
package-lock.json | ||
/storage/ | ||
mongodb-binaries/ | ||
/profiling/ | ||
/.vscode/ | ||
.idea |
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 @@ | ||
12.18.3 |
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,5 @@ | ||
{ | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true | ||
} |
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,19 @@ | ||
const gulp = require('gulp'); | ||
const ts = require('gulp-typescript'); | ||
|
||
function getTsconfig(env) { | ||
if (env != null) { | ||
return `tsconfig.${env.toLowerCase()}.json`; | ||
} | ||
|
||
return 'tsconfig.json'; | ||
} | ||
|
||
const tsProject = ts.createProject(getTsconfig(process.env.NODE_ENV)); | ||
|
||
const outDir = 'dist' | ||
|
||
gulp.task('default', () => tsProject.src() | ||
.pipe(tsProject()) | ||
.pipe(gulp.dest(outDir)) | ||
); |
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,82 @@ | ||
{ | ||
"name": "design-system", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"run": "node dist/index.js", | ||
"build:production": "cross-env NODE_ENV=production npm run build", | ||
"build": "gulp", | ||
"neon": "neon", | ||
"lint": "eslint --fix . --resolve-plugins-relative-to .", | ||
"lint:staged": "lint-staged", | ||
"test": "jest", | ||
"package:init": "script/init-package.sh package", | ||
"package:sync": "script/sync-package.sh package", | ||
"package:neon:init": "script/init-neon-package.sh package", | ||
"tsc:init": "tsc --init", | ||
"eslint": "eslint", | ||
"all:build": "script/run-script-all-package.sh build", | ||
"all:build:production": "script/run-script-all-package.sh build:production" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/CourseDesign/design-system.git" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/CourseDesign/design-system/issues" | ||
}, | ||
"homepage": "https://github.com/CourseDesign/design-system#readme", | ||
"husky": { | ||
"hooks": { | ||
"pre-push": "npm run test", | ||
"pre-commit": "npm run lint:staged" | ||
} | ||
}, | ||
"lint-staged": { | ||
"src/*.{js,ts}": [ | ||
"eslint --fix" | ||
] | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.ts$": "ts-jest" | ||
}, | ||
"testRegex": "\\.spec\\.ts$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"js" | ||
], | ||
"modulePathIgnorePatterns": [ | ||
"dist" | ||
], | ||
"globals": { | ||
"ts-jest": { | ||
"diagnostics": true | ||
} | ||
} | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^26.0.10", | ||
"@types/node": "^14.6.0", | ||
"@typescript-eslint/eslint-plugin": "^3.10.1", | ||
"@typescript-eslint/parser": "^3.10.1", | ||
"cross-env": "^7.0.2", | ||
"eslint": "^7.7.0", | ||
"eslint-config-airbnb-base": "^14.2.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-import": "^2.22.0", | ||
"eslint-plugin-prettier": "^3.1.4", | ||
"gulp": "^4.0.2", | ||
"gulp-typescript": "^6.0.0-alpha.1", | ||
"husky": "^4.2.5", | ||
"jest": "^26.4.2", | ||
"lint-staged": "^10.2.13", | ||
"neon-cli": "^0.4.0", | ||
"prettier": "^2.1.1", | ||
"ts-jest": "^26.3.0", | ||
"typescript": "^4.0.2" | ||
} | ||
} |
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,23 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const rootPackagePath = process.argv[2]; | ||
if (rootPackagePath == null) { | ||
console.error('Root package is undefined!'); | ||
process.exit(1); | ||
} | ||
|
||
const packagePath = process.argv[3]; | ||
if (packagePath == null) { | ||
console.error('Package is undefined!'); | ||
process.exit(1); | ||
} | ||
const eslintrcJson = require(`${rootPackagePath}/.eslintrc.json`); | ||
|
||
const { project } = eslintrcJson.parserOptions; | ||
|
||
const diff = path.relative(rootPackagePath, packagePath); | ||
|
||
project.push(`${diff}/tsconfig.json`); | ||
|
||
fs.writeFileSync(`${rootPackagePath}/.eslintrc.json`, JSON.stringify(eslintrcJson, null, 2) + '\n'); |
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,24 @@ | ||
const fs = require('fs'); | ||
|
||
const packagePath = process.argv[2]; | ||
if (packagePath == null) { | ||
console.error('Package is undefined!'); | ||
process.exit(1); | ||
} | ||
|
||
const scriptName = process.argv[3]; | ||
if (scriptName == null) { | ||
console.error('Script name is undefined!'); | ||
process.exit(1); | ||
} | ||
|
||
const script = process.argv[4]; | ||
if (script == null) { | ||
console.error('Script is undefined!'); | ||
process.exit(1); | ||
} | ||
|
||
const packageJson = require(packagePath); | ||
packageJson.scripts[scriptName] = script; | ||
|
||
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + '\n'); |
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,25 @@ | ||
const fs = require('fs'); | ||
|
||
const packagePath = process.argv[2]; | ||
if (packagePath == null) { | ||
console.error('Package is undefined!'); | ||
process.exit(1); | ||
} | ||
|
||
const packageJson = require(packagePath); | ||
|
||
const key = process.argv[3]; | ||
if (key == null) { | ||
console.error('Key is undefined!'); | ||
process.exit(1); | ||
} | ||
|
||
const value = process.argv[4]; | ||
if (value == null) { | ||
console.error('Value is undefined!'); | ||
process.exit(1); | ||
} | ||
|
||
packageJson[key] = value; | ||
|
||
fs.writeFileSync(packagePath, JSON.stringify(packageJson, null, 2) + '\n'); |
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,46 @@ | ||
const fs = require('fs'); | ||
|
||
const sourcePackagePath = process.argv[2]; | ||
if (sourcePackagePath == null) { | ||
console.error('Source package is undefined!'); | ||
process.exit(1); | ||
} | ||
|
||
const sourcePackageJson = require(sourcePackagePath); | ||
|
||
const targetPackagePath = process.argv[3]; | ||
if (targetPackagePath == null) { | ||
console.error('Target package is undefined!'); | ||
process.exit(1); | ||
} | ||
|
||
const targetPackageJson = require(targetPackagePath); | ||
|
||
const key = process.argv[4]; | ||
if (key == null) { | ||
console.error('Key is undefined!'); | ||
process.exit(1); | ||
} | ||
|
||
const tokens = key.split('.').reverse(); | ||
|
||
let source = sourcePackageJson; | ||
let target = targetPackageJson; | ||
while (tokens.length > 1) { | ||
const token = tokens.pop(); | ||
|
||
if (source[token] == null) { | ||
process.exit(1); | ||
} | ||
if (target[token] == null) { | ||
target[token] = {} | ||
} | ||
|
||
source = source[token]; | ||
target = target[token]; | ||
} | ||
|
||
const token = tokens.pop(); | ||
target[token] = source[token]; | ||
|
||
fs.writeFileSync(targetPackagePath, JSON.stringify(targetPackageJson, null, 2) + '\n'); |
Oops, something went wrong.