安装nix并配置channel:
sudo install -d -m755 -o $(id -u) -g $(id -g) /nix
curl https://nixos.org/nix/install | sh
nix-channel --add https://nixos.org/channels/nixos-20.03 nixos-20.03
nix-channel --update nixos-20.03
安装yarn
nix-env -f ~/.nix-defexpr/channels/nixos-20.03 -iA yarn
安装ember
yarn global add ember-cli
创建ember项目
ember new ember-larluo
cd ember-larluo
添加typescript支持
yarn add typescript -D
yarn add @types/ember-resolver
ember install ember-cli-typescript@latest
修改配置
- 添加 APP {}选项
- 修改'../app'至 'ember-larluo/app';
larrys-MacBook-Pro:ember-larluo larluo$ cp app/config/environment.d.ts config/environment.d.ts
larrys-MacBook-Pro:ember-larluo larluo$ cat config/environment.d.ts
export default config;
/**
* Type declarations for
* import config from './config/environment'
*
* For now these need to be managed by the developer
* since different ember addons can materialize new entries.
*/
declare const config: {
environment: any;
modulePrefix: string;
podModulePrefix: string;
locationType: string;
rootURL: string;
APP: {} ;
};
larrys-MacBook-Pro:ember-larluo larluo$ cat tests/test-helper.ts
import Application from 'ember-larluo/app';
import config from '../config/environment';
import { setApplication } from '@ember/test-helpers';
import { start } from 'ember-qunit';
setApplication(Application.create(config.APP));
start();
切换到ts文件
mv app/app.js app/app.ts
mv app/router.js app/router.ts
mv ./tests/test-helper.js ./tests/test-helper.ts
网友评论