Skip to content
This repository has been archived by the owner on Feb 2, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' into devlopment
Browse files Browse the repository at this point in the history
  • Loading branch information
virkt25 committed Sep 22, 2017
2 parents bff09d1 + 6e60cfa commit 698bcb5
Show file tree
Hide file tree
Showing 18 changed files with 275 additions and 103 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
dist
dist6
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"eslintIntegration": true,
"bracketSpacing": false,
"singleQuote": true,
"printWidth": 80,
"trailingComma": "all"
}
22 changes: 22 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"editor.rulers": [80],
"editor.tabCompletion": true,
"editor.tabSize": 2,
"editor.trimAutoWhitespace": true,
"editor.formatOnSave": true,

"files.exclude": {
"**/.DS_Store": true,
"**/.git": true,
"**/.hg": true,
"**/.svn": true,
"**/CVS": true,
"dist": true,
"dist6": true
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,

"tslint.ignoreDefinitionFiles": true,
"typescript.tsdk": "./node_modules/typescript/lib"
}
46 changes: 46 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"taskName": "Watch and compile TypeScript",
"command": "tsc",
"args": ["--watch"],
"type": "process",
"isBackground": true,
"problemMatcher": "$tsc-watch",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "never",
"focus": false,
"panel": "dedicated"
}
},
{
"taskName": "Test and lint",
"command": "npm",
"args": [
"--silent",
"run",
"vscode-test"
],
"type": "process",
"group": {
"kind": "test",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "dedicated"
},
"problemMatcher": "$tslint5"
}
]
}
21 changes: 21 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Developer's Guide

We use Visual Studio Code for developing LoopBack and recommend the same to our contributors.

While this package supports both Node.js 6.x and 8.x versions, you will need Node.js 8.x (or newer) for the best development experience in VS Code.

## VSCode setup

Install the following extensions:

- [tslint](https://marketplace.visualstudio.com/items?itemName=eg2.tslint)
- [prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)

## Development workflow

1. Start the build task (Cmd+Shift+B), it will run TypeScript compiler in backround, watching and recompiling files as you change them. Compilation errors will be shown in the VSCode's "PROBLEMS" window.


2. Execute "Test and lint" task (Cmd+Shift+T) to re-run the test suite and lint the code for both programming and style errors. Linting errors will be shown in VSCode's "PROBLEMS" window. Failed tests are printed to terminal output only.

3. Run "npm test" explicitly before committing your changes. This will execute the same sequence as our CI server does.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# loopback-next-extension-starter
A starter project to create extensions for loopback-next
A starter project to create extensions for loopback-next.

There are various kinds of Extensions that you can create for LoopBack Next.
Extensions can add new features / functions to `@loopback/core`, provide
Expand Down Expand Up @@ -44,4 +44,3 @@ __Used by Components ... Need more details__
A Repository is a DataSource that is used by `legacy-juggler` or as formerly known
as in LoopBack 3, a connector. Write your own Repository extension to interface
with any database of your choice.

6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright IBM Corp. 2017. All Rights Reserved.
// Node module: @loopback/core
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

export * from './dist/lib';
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright IBM Corp. 2017. All Rights Reserved.
// Node module: @loopback/core
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

const nodeMajorVersion = +process.versions.node.split('.')[0];
module.exports = nodeMajorVersion >= 7 ?
require('./dist/lib') :
require('./dist6/lib');
25 changes: 24 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@
"description": "A starter project for LoopBack Next Extensions",
"main": "index.js",
"scripts": {
"test": "npm test"
"build": "npm run build:lib && npm run build:lib6",
"build:lib": "tsc --target es2017 --outDir dist",
"build:lib6": "tsc --target es2015 --outDir dist6",
"lint": "tslint -c tslint.full.json --project tsconfig.json --type-check",
"lint:fix": "npm run lint -- --fix",
"prepublish": "npm run build",
"pretest": "npm run build",
"test": "mocha",
"posttest": "npm run lint",
"vscode-test": "mocha && npm run lint"
},
"repository": {
"type": "git",
Expand All @@ -16,8 +25,22 @@
"url": "https://github.com/strongloop/loopback-next-extension-starter/issues"
},
"homepage": "https://github.com/strongloop/loopback-next-extension-starter#readme",
"files": [
"README.md",
"index.js",
"index.d.ts",
"dist",
"dist6"
],
"dependencies": {
"@loopback/core": "^4.0.0-alpha.14",
"@loopback/repository": "^4.0.0-alpha.8"
},
"devDependencies": {
"@loopback/testlab": "^4.0.0-alpha.7",
"@types/mocha": "^2.2.43",
"mocha": "^3.5.3",
"tslint": "^5.7.0",
"typescript": "^2.5.2"
}
}
3 changes: 3 additions & 0 deletions src/controllers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Controllers

This directory contains source files for the controllers exported by this extension.
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright IBM Corp. 2013,2017. All Rights Reserved.
// Node module: loopback-next-extension-starter
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT
4 changes: 4 additions & 0 deletions src/providers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Providers

This directory contains providers contributing additional bindings, for example
custom sequence actions.
3 changes: 3 additions & 0 deletions src/repositories/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Repositories

This directory contains code for repositories provided by this extension.
3 changes: 3 additions & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--recursive
--reporter dot
dist/test
12 changes: 12 additions & 0 deletions test/smoke.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright IBM Corp. 2017. All Rights Reserved.
// Node module: loopback-next-extension-starter
// This file is licensed under the MIT License.
// License text available at https://opensource.org/licenses/MIT

import {expect} from '@loopback/testlab';

describe('Smoke test to verify project setup - remove me later', () => {
it('works', () => {
expect(true).to.equal(true);
});
});
30 changes: 20 additions & 10 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
{
"extends": "./tsconfig.common.json",
"include": [
"src"
],
"exclude": [
"node_modules/**",
"**/*.d.ts"
]
}

"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"strictNullChecks": true,
"noUnusedLocals": true,

"lib": ["es2017", "dom"],
"module": "commonjs",
"moduleResolution": "node",
"target": "es2017",
"outDir": "dist",
"sourceMap": true,
"declaration": true
},
"include": [
"src",
"test"
]
}
37 changes: 18 additions & 19 deletions tslint.full.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
{
"$schema": "http://json.schemastore.org/tslint",
"extends": [
"./tslint.json"
],
// This configuration files enabled rules which require type checking
// and therefore cannot be run by Visual Studio Code TSLint extension
// See https://github.com/Microsoft/vscode-tslint/issues/70
"rules": {
// These rules find errors related to TypeScript features.


// These rules catch common errors in JS programming or otherwise
// confusing constructs that are prone to producing bugs.

"await-promise": true,
"no-floating-promises": true,
"no-void-expression": [true, "ignore-arrow-function-shorthand"]
}
"$schema": "http://json.schemastore.org/tslint",
"extends": [
"./tslint.json"
],
// This configuration files enabled rules which require type checking
// and therefore cannot be run by Visual Studio Code TSLint extension
// See https://github.com/Microsoft/vscode-tslint/issues/70
"rules": {
// These rules find errors related to TypeScript features.


// These rules catch common errors in JS programming or otherwise
// confusing constructs that are prone to producing bugs.

"await-promise": true,
"no-floating-promises": true,
"no-void-expression": [true, "ignore-arrow-function-shorthand"]
}
}
Loading

0 comments on commit 698bcb5

Please sign in to comment.