Skip to content

Commit

Permalink
feat: init typescript (#1570)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshaaban0 committed Feb 9, 2023
1 parent 19aa14d commit 05dff9f
Show file tree
Hide file tree
Showing 8 changed files with 23,769 additions and 13,551 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Expand Up @@ -14,6 +14,7 @@ jobs:
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: npm ci
- run: npm run tsc
- run: npm test
- run: npm run tsc -- --noEmit
integration:
Expand All @@ -26,6 +27,7 @@ jobs:
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
- run: npm ci
- run: npm run tsc
- run:
command: npm run test:integration:ci
no_output_timeout: 20m
Expand Down Expand Up @@ -62,6 +64,7 @@ jobs:
template-preset: 'semantic-release-ecosystem'
- run: git fetch --tags
- run: npm ci
- run: npm run tsc
- run: npm run semantic-release
audit:
docker: &ref_0
Expand Down
16 changes: 10 additions & 6 deletions .eslintrc.js
@@ -1,17 +1,21 @@
module.exports = {
extends: ['eslint:recommended', 'prettier'],
plugins: ['jest', 'prettier'],
parserOptions: {
ecmaVersion: 2018
},
extends: [
'eslint:recommended',
'prettier',
'plugin:@typescript-eslint/recommended'
],
plugins: ['jest', 'prettier', '@typescript-eslint'],
parser: '@typescript-eslint/parser',
env: {
jest: true,
node: true,
es6: true
},
rules: {
'prettier/prettier': ['error'],
'require-atomic-updates': ['warn']
'require-atomic-updates': ['warn'],
'@typescript-eslint/no-var-requires': ['warn'],
'@typescript-eslint/ban-ts-comment': ['warn']
},
overrides: [
{
Expand Down
2 changes: 1 addition & 1 deletion bin/contentful.js
@@ -1,3 +1,3 @@
#!/usr/bin/env node

require('../output/lib/cli.js')
require('../dist/cli.js')
10 changes: 3 additions & 7 deletions lib/cli.js → lib/cli.ts
@@ -1,10 +1,6 @@
const yargs = require('yargs')
const { log } = require('./utils/log')
const {
buildContext,
getCommand,
assertContext
} = require('./utils/middlewares')
import yargs from 'yargs'
import { log } from './utils/log'
import { buildContext, getCommand, assertContext } from './utils/middlewares'
const { version } = require('../package.json')

yargs
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/middlewares.js
Expand Up @@ -64,7 +64,8 @@ module.exports.buildContext = async argv => {
return { context }
}

module.exports.assertContext = async ({ cmd, context }) => {
module.exports.assertContext = async params => {
const { cmd, context } = params
const { noAuthNeeded, noSpaceIdNeeded } = config

if (cmd && !noAuthNeeded.includes(cmd)) {
Expand Down

0 comments on commit 05dff9f

Please sign in to comment.