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
try { | |
require('./bad-require') | |
} catch (error) { | |
console.error('first error:', error.message) | |
} | |
try { | |
require('./bad-require') | |
} catch (error) { | |
console.error('second error:', error.message) |
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
import * as mage from 'mage' | |
import { Acl } from 'mage-validator' | |
import { IsInt, Max, ValidateNested } from 'class-validator'; | |
import PlayerData from '../types/PlayerData' | |
export default class { | |
@IsInt() | |
@Min(1) | |
public gemRegisterBonus: number |
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
import {validate, Contains, IsInt, Length, IsEmail, IsFQDN, IsDate, Min, Max} from "class-validator"; | |
export class Post { | |
@Length(10, 20) | |
title: string; | |
@Contains("hello") | |
text: string; | |
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
import * as path from 'path' | |
import * as ts from 'typescript' | |
const glob = require('glob') | |
const globPattern = path.join(this.projectPath, 'lib/modules/**/usercommands/*.ts') | |
const userCommandFiles = glob.sync(globPattern) | |
// Build a program using the set of root file names in fileNames | |
const program = ts.createProgram(this.userCommandFiles, { |
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
{ | |
"name": "my-game", | |
"description": "Super duper", | |
"version": "0.0.1", | |
"repository": "...", | |
"author": "Marc Trudel <mtrudel@...jp>", | |
"license": "See LICENSE%", | |
"scripts": { | |
"help": " echo 'Display help information (this screen)' && npm run", | |
"mage": " echo 'Run the mage binary' && mage", |
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
npm install mage --bootstrap --prefix my-project | |
cd my-project |
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
mkdir my-project | |
cd my project | |
npm install mage --bootstrap |
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
npm install mage -- --bootstrap |
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
var npmArgs = JSON.parse(process.env.npm_config_argv); | |
if (npmArgs.original.indexOf('--bootstrap') === -1) { | |
process.exit(0); | |
} |
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
mkdir my-project | |
cd my-project | |
BOOTSTRAP=true npm install mage |