{"id":15882392,"url":"https://github.com/another-guy/demo-ts-package","last_synced_at":"2026-04-29T17:35:03.295Z","repository":{"id":89024140,"uuid":"105410717","full_name":"another-guy/demo-ts-package","owner":"another-guy","description":"Demo TS package from scratch","archived":false,"fork":false,"pushed_at":"2017-11-28T18:59:33.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-28T14:03:16.078Z","etag":null,"topics":["demo","module","package","typescript"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/another-guy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-01T00:56:14.000Z","updated_at":"2017-10-01T01:06:00.000Z","dependencies_parsed_at":"2023-06-13T14:46:09.187Z","dependency_job_id":null,"html_url":"https://github.com/another-guy/demo-ts-package","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/another-guy/demo-ts-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/another-guy%2Fdemo-ts-package","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/another-guy%2Fdemo-ts-package/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/another-guy%2Fdemo-ts-package/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/another-guy%2Fdemo-ts-package/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/another-guy","download_url":"https://codeload.github.com/another-guy/demo-ts-package/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/another-guy%2Fdemo-ts-package/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32437058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T17:34:55.123Z","status":"ssl_error","status_checked_at":"2026-04-29T17:34:45.749Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["demo","module","package","typescript"],"created_at":"2024-10-06T04:02:57.329Z","updated_at":"2026-04-29T17:35:03.289Z","avatar_url":"https://github.com/another-guy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Steps\n\n## Initialize Git\n\n```bash\ngit init\n```\n\n`.gitignore`\n\n```bash\nnode_modules/\ncoverage/\nbin/\ndist/\nsrc/*.js\ntest/*.js\ntest/report.html\n```\n\n## Initialize NPM package\n\n```bash\nnpm init\n```\n\n```txt\npackage name: (demo-ts-package)\nversion: (1.0.0) 0.0.1\ndescription: Demo TS package.\nentry point: ./dist/index.js\ntest command:\ngit repository: https://github.com/another-guy/demo-ts-package\nkeywords:\nauthor: Igor Soloydenko\nlicense: (ISC) MIT\n```\n\n## Create directories\n\n```bash\nmkdir src test .config\ntouch src/.gitkeep test/.gitkeep .config/.gitkeep\n```\n\n## Initialize TypeScript\n\n```bash\ntsc --init\n```\n\nOverride the following values:\n\n```js\n\"target\": \"es2015\",    /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */\n\"module\": \"commonjs\",  /* Specify module code generation: 'none', commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */\n\"lib\": [\"dom\", \"es2015\"],\n\"declaration\": true,   /* Generates corresponding '.d.ts' file. */\n\"sourceMap\": true,     /* Generates corresponding '.map' file. */\n\"outDir\": \"./dist\",    /* Redirect output structure to the directory. */\n\"strict\": true         /* Enable all strict type-checking options. */\n```\n\n## Add dependencies\n\n```bash\nnpm i --SD typescript tslint karma-typescript karma-chrome-launcher puppeteer karma-htmlfile-reporter karma @types/mocha mocha karma-mocha @types/chai chai karma-chai\n```\n\n## Initialize Karma\n\nImportant!\n\n```bash\n\"C:\\Program Files\\Git\\bin\\bash.exe\" --login -i\n./node_modules/karma/bin/karma init ./.config/karma.conf.js\n\nmocha\nno Require.js\nChromeHeadless\nsrc/**/*.ts\ntest/**/*.ts\nwatch, not single run\n```\n\n**karma.conf.js** looks as following. (See http://karma-runner.github.io/1.0/config/configuration-file.html for more details).\n\n```js\n// Karma configuration\n\nprocess.env.CHROME_BIN = require('puppeteer').executablePath();\n\nmodule.exports = function(config) {\n  config.set({\n    // base path that will be used to resolve all patterns (eg. files, exclude)\n    basePath: '..',\n\n    plugins: [\n      'karma-mocha',\n      'karma-chrome-launcher',\n      'karma-chai',\n      'karma-typescript',\n      'karma-htmlfile-reporter',\n    ],\n\n    // frameworks to use. available frameworks: https://npmjs.org/browse/keyword/karma-adapter\n    frameworks: [\n      'karma-typescript',\n      'mocha'\n    ],\n\n    // list of files / patterns to load in the browser\n    files: [\n      'src/**/*.ts',\n      'test/**/*.ts'\n    ],\n\n    // list of files to exclude\n    exclude: [\n    ],\n\n    // preprocess matching files before serving them to the browser. available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor\n    preprocessors: {\n      '**/*.ts': [\n        'karma-typescript',\n      ],\n    },\n\n    karmaTypescriptConfig: {\n      tsconfig: \"./tsconfig.json\",\n    },\n\n    // test results reporter to use. possible values: 'dots', 'progress'. available reporters: https://npmjs.org/browse/keyword/karma-reporter\n    reporters: [\n      'progress',\n      'karma-typescript',\n    ],\n\n    // web server port\n    port: 9876,\n\n    // enable / disable colors in the output (reporters and logs)\n    colors: true,\n\n    // level of logging. possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG\n    logLevel: config.LOG_INFO,\n\n    // start these browsers. available browser launchers: https://npmjs.org/browse/keyword/karma-launcher\n    browsers: [\n      'ChromeHeadless',\n    ],\n\n    // enable / disable watching file and executing tests whenever any file changes\n    autoWatch: true,\n\n    // Continuous Integration mode. if true, Karma captures browsers, runs the tests and exits\n    singleRun: false,\n\n    // Concurrency level. how many browser should be started simultaneous\n    concurrency: Infinity,\n\n    htmlReporter: {\n      outputFile: 'test/report.html',\n    },\n  });\n};\n```\n\n## Initialize `tslint.json` under `.config` directory\n\n```js\n{\n  \"defaultSeverity\": \"error\",\n  \"extends\": [\n    \"tslint:recommended\"\n  ],\n  \"jsRules\": {},\n  \"rules\": {\n    \"arrow-parens\": [true, \"ban-single-arg-parens\"],\n    \"member-access\": [true, \"no-public\"],\n    \"quotemark\": [true, \"single\"],\n    \"array-type\": [true, \"array\"],\n    \"curly\": [true, \"ignore-same-line\"],\n    \"object-literal-sort-keys\": [false],\n    \"interface-name\": [true, \"never-prefix\"],\n    \"no-empty-interface\": [false]\n  },\n  \"rulesDirectory\": []\n}\n```\n\n## Custom scripts in `package.json`\n\n```js\n\"test\": \"karma start\",\n\"test:single-run\": \"karma start --single-run\",\n\"tslint\": \"tslint -c ./.config/tslint.json 'src/**/*.ts' -t stylish\",\n\"double-check\": \"npm run test:single-run \u0026\u0026 npm run tslint\"\n```\n\n## Add `settings.json` under `.vscode` directory\n\n```js\n{\n  \"tslint.configFile\": \".config/tslint.json\",\n  \"tslint.autoFixOnSave\": true,\n  \"tslint.enable\": true,\n  \"editor.tabSize\": 2\n}\n```\n\n## Sources\n\nhttps://medium.com/powtoon-engineering/a-complete-guide-to-testing-javascript-in-2017-a217b4cd5a2a\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanother-guy%2Fdemo-ts-package","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanother-guy%2Fdemo-ts-package","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanother-guy%2Fdemo-ts-package/lists"}